<!DOCTYPE html>
<html lang="zh">
<head>
<title>雅菡珠宝</title>
<link href="{{url_for('static', filename='themes/yahan/css/s_style.css')}}" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="{{url_for('static', filename='js/jquery-1.8.3.min.js')}}"></script>
<script language="JavaScript" type="text/javascript">
//<![CDATA[
    $(document).ready(function(){
        $("#name").focus();
    })
    function s4() {
        return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
    }
    function guid() {
        return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
    }
    function validate(){
        var msgs = []
        if(!$('#name').val())
            msgs.push('请填写用户名.')
        if(!$('#password').val())
            msgs.push('请填写密码.')
        if(!$('#captcha').val())
            msgs.push('请填写验证码.')
        return msgs
    }
    function toSubmit(){
        var msgs = validate()
        if(msgs.length==0) return true;
        else{
            $('#td_alert').html('<div class="alert alert-error">'+msgs.join("<br/>")+'<div>')
            return false   
        }
    }
    function toLogin(){
        var msgs = validate()
        if(msgs.length==0) $('#_form').submit()
        else $('#td_alert').html('<div class="alert alert-error">'+msgs.join("<br/>")+'<div>')
    }
    function changeCap(){
        $('#cap').attr('src', '/auth/get_captcha?'+guid())
    }
    /*
=======
    
    $(function() {
        $('form').each(function() {
            $('input').keypress(function(e) {
                // Enter pressed?
                if(e.which == 10 || e.which == 13) {
                    this.form.submit();
                }
            });
        });
    });
>>>>>>> .r103
*/
//]]>
</script>
</head>
<body>
    <div class="s_head">&nbsp;</div>
    <div class="s_login_main">
        <div class="login_enter">
            <div style="text-align:center; padding:0px 0px 30px 0px;">
                <img src="{{url_for('static', filename='themes/yahan/img/login_03.png')}}" width="184" height="302" />
            </div>
            <form class="form-signin" action="{{url_for('bpAuth.login')}}" method="post" id='_form' onsubmit='return toSubmit()'>
                <table width="500" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <td width="400">
                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                    <td width="100" height="50" align="right">用户名：</td>
                                    <td align='center'>
                                        <input type="text" class="input-block-level" placeholder="用户名" name="name" id="name">
                                    </td>
                                </tr>
                                <tr>
                                    <td height="50" align="right">密&nbsp;&nbsp;&nbsp;码：</td>
                                    <td align='center'>
                                        <input type="password" class="input-block-level" placeholder="密码" name="password" id="password">
                                    </td>
                                </tr>
                                <tr>
                                    <td height="50" align="right">验证码：</td>
                                    <td align='center'>
                                        <input type="text" name="captcha" id="captcha" style="width:70px;" size="10"/>
                                        <img title='看不清？点击刷新图片' id='cap' src="/auth/get_captcha" style="vertical-align:middle;padding-right: 20px;" onclick='changeCap()'/>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan=2 style='padding-left:52px;' id='td_alert'>
                                        {% with messages = get_flashed_messages(category_filter=[MESSAGE_ERROR]) %}
                                        {% if messages %}
                                            <div class="alert alert-error">
                                                {% for msg in messages %}
                                                    {{ msg }}<br/>
                                                {% endfor %}
                                            </div>
                                        {% endif %}
                                        {% endwith %}
                                    </td>
                                </tr>
                            </table>
                        </td>
                        <td valign='top' style='padding-top:10px;'>
                            <input type="submit" style="position:absolute;left:-9999px;width:1px;height:1px;"/>
                            <a href='javascript:toLogin()'>
                                <img src="{{url_for('static', filename='themes/yahan/img/login_10.png')}}" width="76" height="76" />
                            </a>
                            <div>
                                <a href="{{ url_for('bpAuth.forget_password', t='input_email') }}" style="color: white;">忘记密码？</a>
                            </div>
                        </td>
                    </tr>
                </table>
            </form>
        </div>
    </div>
    <div class='s_login_foot'>
        <img src="{{url_for('static', filename='themes/yahan/img/c_bottom_logo.png')}}" width="215" height="81" />
    </div>
</body>
</html>